/*
 * @Author: wei_jt@ecidi.com
 * @Date: 2019-11-21 20:22:59
 * @LastEditors: wei_jt@ecidi.com
 * @LastEditTime: 2022-06-22 09:51:24
 * @Description: 多语言接口
 */
import request from '@/utils/request'

/** 获取模块树 */
export function getCategory () {
  return request({
    url: '/sys-system/lang/tree',
    method: 'get',
  })
}

export function getModules (params) {
  return request({
    url: '/sys-system/lang/property/page',
    method: 'get',
    params: {
      ...params
    }
  })
}

/** 保存类别/模块 */
export function save (data) {
  return request({
    url: '/sys-system/lang/property',
    method: 'post',
    data: data,
  })
}
/** 编辑模块 */
export function editCurrentModule (data) {
  return request({
    url: '/sys-system/lang/property',
    method: 'put',
    data: data,
  })
}
/** 删除模块 */
export function deleteModule (id) {
  return request({
    url: '/sys-system/lang/property',
    method: 'DELETE',
    params: {
      id
    }
  })
}

/** 新增/保存语言资源 */
export function saveResource (data) {
  return request({
    url: '/sys-system/lang/detail',
    method: 'post',
    data: data,
    transformRequest: function (data) {
      // 对 data 进行任意转换处理
      return JSON.stringify(data)
    },
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/** 新增多语言详情 */
export function addLangDetail (data) {
  return request({
    url: '/sys-system/lang/detail',
    method: 'post',
    data: data,
  })
}
/** 删除详情 */
export function deleteDetail (data) {
  return request({
    url: '/sys-system/lang/detail',
    method: 'DELETE',
    params: data
  })
}
//获取id所有语言详情-不分页
export function getCurrentDetail (data) {
  return request({
    url: '/sys-system/lang/detail',
    method: 'get',
    params: data
  })
}
//获取id所有语言详情-分页
export function getAllDetail (data) {
  return request({
    url: '/sys-system/lang/detail/page',
    method: 'get',
    params: data
  })
}
//按名称搜索模块
export function searchModule (data) {
  return request({
    url: '/sys-system/lang/property/page',
    method: 'get',
    params: data
  })
}
//获取指定code的所有语言翻译
export function getCodeDetail (data) {
  return request({
    url: '/sys-system/lang/detail/code',
    method: 'get',
    params: data
  })
}